/*     */ package btsm.bean;
/*     */ 
/*     */ import java.io.PrintStream;
/*     */ import java.sql.ResultSet;
/*     */ import java.sql.ResultSetMetaData;
/*     */ import java.text.SimpleDateFormat;
/*     */ import java.util.Date;
/*     */ 
/*     */ public class sqlCableWork
/*     */ {
/*  15 */   String scsql = "";
/*  16 */   String addsql = "";
/*  17 */   String mdsql = "";
/*  18 */   String delsql = "";
/*  19 */   String strDQXSFilter = "5113%";
/*  20 */   public String tablesw = "";
/*  21 */   public String wheresw = "";
/*  22 */   public String idsw = "";
/*     */ 
/*  25 */   public int listindexsw = 0;
/*  26 */   public int listworksw = 0;
/*  27 */   public String textsw = null;
/*     */ 
/*  29 */   private dbConnector dbcon = null;
/*  30 */   private sysPro sPro = new sysPro();
/*     */ 
/*     */   public sqlCableWork(String tableswa, String idswa)
/*     */   {
/*  35 */     this.tablesw = tableswa;
/*     */ 
/*  37 */     this.idsw = idswa;
/*  38 */     this.strDQXSFilter = this.sPro.getPFilter();
/*     */   }
/*     */ 
/*     */   private void dbConInit() {
/*  42 */     if (this.dbcon == null)
/*  43 */       this.dbcon = new dbConnector();
/*     */   }
/*     */ 
/*     */   public void dbConClose() {
/*  47 */     if (this.dbcon != null)
/*  48 */       this.dbcon.closeAll();
/*  49 */     this.dbcon = null;
/*     */   }
/*     */ 
/*     */   public ResultSet scmeta()
/*     */     throws Exception
/*     */   {
/*  55 */     dbConInit();
/*     */ 
/*  57 */     this.scsql = ("select * from " + this.tablesw + " limit 1");
/*  58 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/*  59 */     ResultSet rs = this.dbcon.execQuery(this.scsql);
/*  60 */     return rs;
/*     */   }
/*     */ 
/*     */   public String[] meta(ResultSet rs) throws Exception
/*     */   {
/*  65 */     dbConInit();
/*     */ 
/*  67 */     ResultSetMetaData rsmd = rs.getMetaData();
/*  68 */     int columnCount = rsmd.getColumnCount();
/*  69 */     String[] cols = new String[columnCount];
/*  70 */     for (int i = 0; i < columnCount; i++) {
/*  71 */       cols[i] = rsmd.getColumnLabel(i + 1);
/*     */     }
/*     */ 
/*  74 */     return cols;
/*     */   }
/*     */ 
/*     */   public String[] metatype(ResultSet rs) throws Exception
/*     */   {
/*  79 */     dbConInit();
/*     */ 
/*  81 */     ResultSetMetaData rsmd = rs.getMetaData();
/*  82 */     int columnCount = rsmd.getColumnCount();
/*     */ 
/*  84 */     String[] coltype = new String[columnCount];
/*  85 */     for (int i = 0; i < columnCount; i++)
/*     */     {
/*  87 */       coltype[i] = rsmd.getColumnTypeName(i + 1);
/*     */     }
/*     */ 
/*  90 */     return coltype;
/*     */   }
/*     */ 
/*     */   public int getUsersCountPage()
/*     */     throws Exception
/*     */   {
/*  96 */     dbConInit();
/*     */ 
/*  98 */     int count = 0;
/*  99 */     ResultSet rs = null;
/* 100 */     if (this.idsw.equalsIgnoreCase(""))
/* 101 */       this.scsql = ("select count(username) as count from " + this.tablesw);
/*     */     else
/* 103 */       this.scsql = ("select count(id) as count from " + this.tablesw);
/*     */     try
/*     */     {
/* 106 */       this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 107 */       rs = this.dbcon.execQuery(this.scsql);
/* 108 */       if (rs.next())
/* 109 */         count = rs.getInt(1);
/*     */     }
/*     */     catch (Exception e) {
/* 112 */       throw e;
/*     */     }
/*     */ 
/* 115 */     return count;
/*     */   }
/*     */ 
/*     */   public ResultSet scUsersPage(int ShowPagesw, int PageSizesw)
/*     */     throws Exception
/*     */   {
/* 121 */     dbConInit();
/*     */ 
/* 123 */     if (this.idsw.equalsIgnoreCase(""))
/* 124 */       this.scsql = ("select * from " + this.tablesw + " where username <> 'system' order by username desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/*     */     else {
/* 126 */       this.scsql = ("select * from " + this.tablesw + " where username <> 'system' order by id desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/*     */     }
/* 128 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 129 */     return this.dbcon.execQuery(this.scsql);
/*     */   }
/*     */ 
/*     */   public int getCountPage()
/*     */     throws Exception
/*     */   {
/* 135 */     int count = 0;
/* 136 */     dbConInit();
/* 137 */     ResultSet rs = null;
/* 138 */     this.scsql = ("select count(occode) as count from " + this.tablesw);
/*     */     try {
/* 140 */       this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 141 */       rs = this.dbcon.execQuery(this.scsql);
/* 142 */       if (rs.next())
/* 143 */         count = rs.getInt(1);
/*     */     }
/*     */     catch (Exception e) {
/* 146 */       throw e;
/*     */     }
/*     */ 
/* 150 */     return count;
/*     */   }
/*     */ 
/*     */   public int getCableCountPage(String strOccode)
/*     */     throws Exception
/*     */   {
/* 156 */     int count = 0;
/* 157 */     dbConInit();
/* 158 */     ResultSet rs = null;
/* 159 */     this.scsql = ("select count(occode) as count from " + this.tablesw + " where occode = \"" + strOccode + "\"");
/*     */     try {
/* 161 */       this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 162 */       rs = this.dbcon.execQuery(this.scsql);
/* 163 */       if (rs.next())
/* 164 */         count = rs.getInt(1);
/*     */     }
/*     */     catch (Exception e) {
/* 167 */       throw e;
/*     */     }
/*     */ 
/* 171 */     return count;
/*     */   }
/*     */ 
/*     */   public int getCountPageBQuery(String strBFilter)
/*     */     throws Exception
/*     */   {
/* 177 */     int count = 0;
/* 178 */     dbConInit();
/* 179 */     ResultSet rs = null;
/*     */ 
/* 181 */     ResultSet schemaRS = scmeta();
/*     */ 
/* 183 */     ResultSetMetaData rsmd = schemaRS.getMetaData();
/* 184 */     int columnCount = rsmd.getColumnCount();
/* 185 */     String[] cols = new String[columnCount];
/*     */ 
/* 187 */     this.scsql = ("select count(*) as count from " + this.tablesw + " where ");
/*     */ 
/* 189 */     for (int i = 0; i < columnCount; i++) {
/* 190 */       cols[i] = rsmd.getColumnLabel(i + 1);
/*     */ 
/* 192 */       if (i < columnCount - 1)
/* 193 */         this.scsql = (this.scsql + cols[i] + " like \"%" + strBFilter + "%\" or ");
/*     */       else {
/* 195 */         this.scsql = (this.scsql + cols[i] + " like \"%" + strBFilter + "%\"");
/*     */       }
/*     */     }
/* 198 */     System.out.println("CableRowCountQQQ:" + this.scsql);
/*     */     try
/*     */     {
/* 201 */       this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 202 */       rs = this.dbcon.execQuery(this.scsql);
/* 203 */       if (rs.next())
/* 204 */         count = rs.getInt(1);
/*     */     }
/*     */     catch (Exception e) {
/* 207 */       throw e;
/*     */     }
/*     */ 
/* 211 */     return count;
/*     */   }
/*     */ 
/*     */   public int getCountPageBFQuery(String strBOccode, String strBFilter)
/*     */     throws Exception
/*     */   {
/* 217 */     int count = 0;
/* 218 */     dbConInit();
/* 219 */     ResultSet rs = null;
/*     */ 
/* 221 */     ResultSet schemaRS = scmeta();
/*     */ 
/* 223 */     ResultSetMetaData rsmd = schemaRS.getMetaData();
/* 224 */     int columnCount = rsmd.getColumnCount();
/* 225 */     String[] cols = new String[columnCount];
/*     */ 
/* 227 */     this.scsql = ("select count(*) as count from " + this.tablesw + " where occode = \"" + strBOccode + "\" and (");
/*     */ 
/* 229 */     for (int i = 0; i < columnCount; i++) {
/* 230 */       cols[i] = rsmd.getColumnLabel(i + 1);
/*     */ 
/* 232 */       if (i < columnCount - 1)
/* 233 */         this.scsql = (this.scsql + cols[i] + " like \"%" + strBFilter + "%\" or ");
/*     */       else {
/* 235 */         this.scsql = (this.scsql + cols[i] + " like \"%" + strBFilter + "%\")");
/*     */       }
/*     */     }
/* 238 */     System.out.println("CableRowCountQQQ:" + this.scsql);
/*     */     try
/*     */     {
/* 241 */       this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 242 */       rs = this.dbcon.execQuery(this.scsql);
/* 243 */       if (rs.next())
/* 244 */         count = rs.getInt(1);
/*     */     }
/*     */     catch (Exception e) {
/* 247 */       throw e;
/*     */     }
/*     */ 
/* 251 */     return count;
/*     */   }
/*     */ 
/*     */   public ResultSet scpage(int ShowPagesw, int PageSizesw)
/*     */     throws Exception
/*     */   {
/* 258 */     dbConInit();
/* 259 */     this.scsql = ("select * from " + this.tablesw + " order by id desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/* 260 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 261 */     ResultSet rs = this.dbcon.execQuery(this.scsql);
/* 262 */     return rs;
/*     */   }
/*     */ 
/*     */   public ResultSet BQuery(int ShowPagesw, int PageSizesw, int iType, String strBFilter)
/*     */     throws Exception
/*     */   {
/* 268 */     dbConInit();
/*     */ 
/* 270 */     ResultSet schemaRS = scmeta();
/*     */ 
/* 273 */     ResultSetMetaData rsmd = schemaRS.getMetaData();
/* 274 */     int columnCount = rsmd.getColumnCount();
/* 275 */     String[] cols = new String[columnCount];
/*     */ 
/* 277 */     this.scsql = ("select * from " + this.tablesw + " where ");
/*     */ 
/* 279 */     for (int i = 0; i < columnCount; i++) {
/* 280 */       cols[i] = rsmd.getColumnLabel(i + 1);
/*     */ 
/* 282 */       if (i < columnCount - 1)
/* 283 */         this.scsql = (this.scsql + cols[i] + " like \"%" + strBFilter + "%\" or ");
/*     */       else {
/* 285 */         this.scsql = (this.scsql + cols[i] + " like \"%" + strBFilter + "%\" ");
/*     */       }
/*     */     }
/*     */ 
/* 289 */     if (iType == 0)
/* 290 */       this.scsql = (this.scsql + " order by occode desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/*     */     else {
/* 292 */       this.scsql = (this.scsql + " order by id desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/*     */     }
/*     */ 
/* 295 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 296 */     System.out.println("BQuery:" + this.scsql);
/*     */ 
/* 298 */     return this.dbcon.execQuery(this.scsql);
/*     */   }
/*     */ 
/*     */   public ResultSet BFQuery(int ShowPagesw, int PageSizesw, int iType, String stroccode, String strBFilter)
/*     */     throws Exception
/*     */   {
/* 304 */     dbConInit();
/*     */ 
/* 306 */     ResultSet schemaRS = scmeta();
/*     */ 
/* 308 */     ResultSetMetaData rsmd = schemaRS.getMetaData();
/* 309 */     int columnCount = rsmd.getColumnCount();
/* 310 */     String[] cols = new String[columnCount];
/* 311 */     String[] coltype = new String[columnCount];
/*     */ 
/* 313 */     this.scsql = ("select * from " + this.tablesw + " where occode = \"" + stroccode + "\" and (");
/*     */ 
/* 315 */     for (int i = 0; i < columnCount; i++) {
/* 316 */       cols[i] = rsmd.getColumnLabel(i + 1);
/*     */ 
/* 318 */       if (i < columnCount - 1)
/* 319 */         this.scsql = (this.scsql + cols[i] + " like \"%" + strBFilter + "%\" or ");
/*     */       else {
/* 321 */         this.scsql = (this.scsql + cols[i] + " like \"%" + strBFilter + "%\") ");
/*     */       }
/*     */     }
/*     */ 
/* 325 */     if (iType == 0)
/* 326 */       this.scsql = (this.scsql + " order by occode desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/*     */     else {
/* 328 */       this.scsql = (this.scsql + " order by id desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/*     */     }
/*     */ 
/* 331 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 332 */     System.out.println("BFQuery:" + this.scsql);
/*     */ 
/* 334 */     return this.dbcon.execQuery(this.scsql);
/*     */   }
/*     */ 
/*     */   public ResultSet scCablePage(int ShowPagesw, int PageSizesw) throws Exception
/*     */   {
/* 339 */     dbConInit();
/* 340 */     if (this.idsw.equalsIgnoreCase(""))
/* 341 */       this.scsql = ("select * from " + this.tablesw + " order by occode desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/*     */     else {
/* 343 */       this.scsql = ("select * from " + this.tablesw + " order by id desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/*     */     }
/* 345 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/*     */ 
/* 347 */     return this.dbcon.execQuery(this.scsql);
/*     */   }
/*     */ 
/*     */   public ResultSet scCableFPage(int ShowPagesw, int PageSizesw)
/*     */     throws Exception
/*     */   {
/* 353 */     dbConInit();
/* 354 */     if (this.idsw.equalsIgnoreCase(""))
/* 355 */       this.scsql = ("select * from " + this.tablesw + " where occode = \"" + this.wheresw + "\" order by occode desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/*     */     else {
/* 357 */       this.scsql = ("select * from " + this.tablesw + " where occode = \"" + this.wheresw + "\" order by id desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/*     */     }
/* 359 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 360 */     System.out.println(this.scsql);
/*     */ 
/* 362 */     return this.dbcon.execQuery(this.scsql);
/*     */   }
/*     */ 
/*     */   public ResultSet scCableFPageByID(int ShowPagesw, int PageSizesw) throws Exception
/*     */   {
/* 367 */     dbConInit();
/* 368 */     this.scsql = ("select * from " + this.tablesw + " where occode = \"" + this.wheresw + "\" order by id desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/* 369 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 370 */     System.out.println(this.scsql);
/*     */ 
/* 372 */     return this.dbcon.execQuery(this.scsql);
/*     */   }
/*     */ 
/*     */   public ResultSet scCablePageByID(int ShowPagesw, int PageSizesw) throws Exception
/*     */   {
/* 377 */     dbConInit();
/* 378 */     this.scsql = ("select * from " + this.tablesw + " order by id desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/* 379 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 380 */     System.out.println(this.scsql);
/* 381 */     return this.dbcon.execQuery(this.scsql);
/*     */   }
/*     */ 
/*     */   public ResultSet scCableMPage(int ShowPagesw, int PageSizesw)
/*     */     throws Exception
/*     */   {
/* 388 */     dbConInit();
/* 389 */     if (this.idsw.equalsIgnoreCase(""))
/* 390 */       this.scsql = ("select * from " + this.tablesw + " order by occode desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/*     */     else {
/* 392 */       this.scsql = ("select * from " + this.tablesw + " order by id desc limit " + (ShowPagesw - 1) * PageSizesw + "," + PageSizesw);
/*     */     }
/* 394 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 395 */     return this.dbcon.execQuery(this.scsql);
/*     */   }
/*     */ 
/*     */   public int getCountList(String dictype) throws Exception
/*     */   {
/* 400 */     dbConInit();
/*     */ 
/* 402 */     int count = 0;
/* 403 */     ResultSet rs = null;
/* 404 */     this.scsql = ("select count(dicname) from dictionary where dictype=\"" + dictype + '"');
/*     */     try {
/* 406 */       this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 407 */       rs = this.dbcon.execQuery(this.scsql);
/* 408 */       if (rs.next())
/* 409 */         count = rs.getInt(1);
/*     */     }
/*     */     catch (Exception e) {
/* 412 */       throw e;
/*     */     }
/*     */ 
/* 416 */     return count;
/*     */   }
/*     */ 
/*     */   public String[] sclist(String dictype) throws Exception
/*     */   {
/* 421 */     dbConInit();
/*     */ 
/* 423 */     String[] list = new String[getCountList(dictype)];
/* 424 */     int i = 0;
/*     */ 
/* 426 */     this.scsql = ("select dicname from dictionary  where dictype=\"" + dictype + '"');
/* 427 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 428 */     ResultSet rs = this.dbcon.execQuery(this.scsql);
/* 429 */     while (rs.next()) {
/* 430 */       list[i] = rs.getString(1);
/* 431 */       i++;
/*     */     }
/*     */ 
/* 434 */     return list;
/*     */   }
/*     */ 
/*     */   public int getCountdqxsList() throws Exception
/*     */   {
/* 439 */     dbConInit();
/*     */ 
/* 441 */     int count = 0;
/*     */ 
/* 443 */     ResultSet rs = null;
/* 444 */     this.scsql = ("select count(distcode) from districtcode where distcode like \"" + this.strDQXSFilter + "\"");
/*     */     try {
/* 446 */       this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 447 */       rs = this.dbcon.execQuery(this.scsql);
/* 448 */       if (rs.next())
/* 449 */         count = rs.getInt(1);
/*     */     }
/*     */     catch (Exception e) {
/* 452 */       throw e;
/*     */     }
/*     */ 
/* 456 */     return count;
/*     */   }
/*     */ 
/*     */   public String[] scdqxslist() throws Exception
/*     */   {
/* 461 */     dbConInit();
/*     */ 
/* 463 */     String[] list = new String[getCountdqxsList()];
/* 464 */     int i = 0;
/*     */ 
/* 466 */     this.scsql = ("select district from districtcode where distcode like \"" + this.strDQXSFilter + "\" order by distcode;");
/* 467 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 468 */     ResultSet rs = this.dbcon.execQuery(this.scsql);
/* 469 */     while (rs.next()) {
/* 470 */       list[i] = rs.getString(1);
/* 471 */       i++;
/*     */     }
/*     */ 
/* 474 */     return list;
/*     */   }
/*     */ 
/*     */   public ResultSet sc()
/*     */     throws Exception
/*     */   {
/* 480 */     dbConInit();
/*     */ 
/* 482 */     if (this.wheresw.equalsIgnoreCase(""))
/*     */     {
/* 484 */       this.scsql = ("select * from " + this.tablesw);
/* 485 */     } else if (this.idsw.equalsIgnoreCase(""))
/* 486 */       this.scsql = ("select * from " + this.tablesw + " where occode=" + '"' + this.wheresw + '"');
/*     */     else {
/* 488 */       this.scsql = ("select * from " + this.tablesw + " where id=" + '"' + this.wheresw + '"');
/*     */     }
/* 490 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/* 491 */     return this.dbcon.execQuery(this.scsql);
/*     */   }
/*     */ 
/*     */   public boolean InsertRD(String[] para)
/*     */   {
/* 497 */     dbConInit();
/*     */ 
/* 499 */     boolean flag = true;
/* 500 */     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
/* 501 */     String strCurDate = sdf.format(new Date());
/* 502 */     String strMeta = ""; String strValues = "";
/*     */ 
/* 504 */     String[] metaa = new String[para.length];
/*     */     try {
/* 506 */       metaa = meta(scmeta());
/*     */     } catch (Exception ex) {
/* 508 */       flag = false;
/* 509 */       ex.printStackTrace();
/*     */     }
/*     */ 
/* 512 */     for (int i = 0; i < para.length - 1; i++) {
/* 513 */       if (!metaa[i].equalsIgnoreCase("id"))
/*     */       {
/* 515 */         if (metaa[i].equalsIgnoreCase("refreshtime")) {
/* 516 */           strMeta = strMeta + metaa[i] + ", ";
/* 517 */           strValues = strValues + '"' + strCurDate + "\",";
/* 518 */         } else if ((para[i].equalsIgnoreCase("")) || (para[i].equals("null"))) {
/* 519 */           strMeta = strMeta + metaa[i] + ", ";
/* 520 */           strValues = strValues + "\"\",";
/* 521 */         } else if (metaa[i].equalsIgnoreCase("passwd")) {
/* 522 */           strMeta = strMeta + metaa[i] + ", ";
/* 523 */           strValues = strValues + "password(\"" + para[i] + "\"), ";
/*     */         } else {
/* 525 */           strMeta = strMeta + metaa[i] + ", ";
/* 526 */           strValues = strValues + '"' + para[i] + "\",";
/*     */         }
/*     */       }
/*     */     }
/* 530 */     if (metaa[(para.length - 1)].equalsIgnoreCase("refreshtime")) {
/* 531 */       strMeta = strMeta + metaa[(para.length - 1)];
/* 532 */       strValues = strValues + '"' + strCurDate + "\"";
/* 533 */     } else if ((para[(para.length - 1)].equalsIgnoreCase("")) || (para[(para.length - 1)].equals("null"))) {
/* 534 */       strMeta = strMeta + metaa[(para.length - 1)];
/* 535 */       strValues = strValues + "\"\"";
/* 536 */     } else if (metaa[(para.length - 1)].equalsIgnoreCase("passwd")) {
/* 537 */       strMeta = strMeta + metaa[(para.length - 1)];
/* 538 */       strValues = strValues + "password(\"" + para[(para.length - 1)] + "\")";
/*     */     } else {
/* 540 */       strMeta = strMeta + metaa[(para.length - 1)];
/* 541 */       strValues = strValues + '"' + para[(para.length - 1)] + "\"";
/*     */     }
/*     */ 
/* 544 */     this.addsql = ("insert into " + this.tablesw + "(" + strMeta + ") values(" + strValues + ")");
/*     */     try
/*     */     {
/* 548 */       this.addsql = new String(this.addsql.getBytes("ISO8859-1"), "UTF-8");
/* 549 */       System.out.println(this.addsql);
/* 550 */       this.dbcon.execUpdate(this.addsql);
/*     */     }
/*     */     catch (Exception ex) {
/* 553 */       flag = false;
/* 554 */       ex.printStackTrace();
/*     */     }
/* 556 */     return flag;
/*     */   }
/*     */ 
/*     */   public boolean add(String[] para)
/*     */   {
/* 562 */     dbConInit();
/*     */ 
/* 564 */     boolean flag = true;
/* 565 */     if (this.idsw.equalsIgnoreCase(""))
/* 566 */       this.addsql = ("insert into " + this.tablesw + " values(");
/*     */     else {
/* 568 */       this.addsql = ("insert into \"" + this.tablesw + '"' + " values(0,");
/*     */     }
/* 570 */     for (int i = 0; i < para.length - 1; i++) {
/* 571 */       if ((para[i].equalsIgnoreCase("")) || (para[i].equals("null")))
/* 572 */         this.addsql += "\"\",";
/*     */       else {
/* 574 */         this.addsql = (this.addsql + '"' + para[i] + '"' + ",");
/*     */       }
/*     */     }
/* 577 */     if ((para[(para.length - 1)].equalsIgnoreCase("")) || (para[(para.length - 1)].equals("null")))
/* 578 */       this.addsql += "\"\")";
/*     */     else {
/* 580 */       this.addsql = (this.addsql + '"' + para[(para.length - 1)] + '"' + ")");
/*     */     }
/*     */     try
/*     */     {
/* 584 */       this.addsql = new String(this.addsql.getBytes("ISO8859-1"), "UTF-8");
/* 585 */       System.out.println(this.addsql);
/* 586 */       this.dbcon.execUpdate(this.addsql);
/*     */     }
/*     */     catch (Exception ex) {
/* 589 */       flag = false;
/* 590 */       ex.printStackTrace();
/*     */     }
/* 592 */     return flag;
/*     */   }
/*     */ 
/*     */   public boolean insertsimple(String stroccode)
/*     */   {
/* 598 */     dbConInit();
/*     */ 
/* 600 */     boolean flag = true;
/* 601 */     this.addsql = ("insert into " + this.tablesw + " (occode) values(\"" + stroccode + "\")");
/*     */     try
/*     */     {
/* 604 */       this.addsql = new String(this.addsql.getBytes("ISO8859-1"), "UTF-8");
/* 605 */       System.out.println(this.addsql);
/* 606 */       this.dbcon.execUpdate(this.addsql);
/*     */     }
/*     */     catch (Exception ex) {
/* 609 */       flag = false;
/* 610 */       ex.printStackTrace();
/*     */     }
/* 612 */     return flag;
/*     */   }
/*     */ 
/*     */   public boolean insertsimple(String stroccode, String strocname)
/*     */   {
/* 618 */     dbConInit();
/*     */ 
/* 620 */     boolean flag = true;
/* 621 */     this.addsql = ("insert into " + this.tablesw + " (occode, ocname) values(\"" + stroccode + "\",\"" + strocname + "\")");
/*     */ 
/* 623 */     System.out.println("insertsimpleBF:" + this.addsql);
/*     */     try {
/* 625 */       this.addsql = new String(this.addsql.getBytes("ISO8859-1"), "UTF-8");
/* 626 */       System.out.println("insertsimpleTR:" + this.addsql);
/* 627 */       this.dbcon.execUpdate(this.addsql);
/*     */     }
/*     */     catch (Exception ex) {
/* 630 */       flag = false;
/* 631 */       ex.printStackTrace();
/*     */     }
/* 633 */     return flag;
/*     */   }
/*     */ 
/*     */   public boolean md(String[] para)
/*     */   {
/* 639 */     dbConInit();
/*     */ 
/* 641 */     boolean flag = true;
/* 642 */     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
/* 643 */     String strCurDate = sdf.format(new Date());
/*     */ 
/* 645 */     String[] metaa = new String[para.length];
/*     */     try {
/* 647 */       metaa = meta(scmeta());
/*     */     } catch (Exception ex) {
/* 649 */       flag = false;
/* 650 */       ex.printStackTrace();
/*     */     }
/*     */ 
/* 653 */     if (this.idsw.equalsIgnoreCase("")) {
/* 654 */       this.mdsql = ("update " + this.tablesw + " set ");
/* 655 */       for (int i = 0; i < para.length; i++) {
/* 656 */         if (i < para.length - 1) {
/* 657 */           if (metaa[i].equalsIgnoreCase("refreshtime"))
/* 658 */             this.mdsql = (this.mdsql + metaa[i] + "=\"" + strCurDate + "\",");
/* 659 */           else if ((para[i].equalsIgnoreCase("")) || (para[i].equals("null")))
/* 660 */             this.mdsql = (this.mdsql + metaa[i] + "=\"\", ");
/*     */           else {
/* 662 */             this.mdsql = (this.mdsql + metaa[i] + "=" + '"' + para[i] + '"' + ',');
/*     */           }
/*     */         }
/* 665 */         else if (metaa[i].equalsIgnoreCase("refreshtime"))
/* 666 */           this.mdsql = (this.mdsql + metaa[i] + "=\"" + strCurDate + "\" ");
/* 667 */         else if ((para[i].equalsIgnoreCase("")) || (para[i].equals("null")))
/* 668 */           this.mdsql = (this.mdsql + metaa[i] + "=\"\" ");
/*     */         else {
/* 670 */           this.mdsql = (this.mdsql + metaa[i] + "=" + '"' + para[i] + '"' + ' ');
/*     */         }
/*     */       }
/*     */ 
/* 674 */       this.mdsql = (this.mdsql + " where occode=" + '"' + this.wheresw + '"');
/*     */     } else {
/* 676 */       this.mdsql = ("update " + this.tablesw + " set ");
/* 677 */       for (int i = 1; i < para.length; i++) {
/* 678 */         if (i < para.length - 1) {
/* 679 */           if (metaa[i].equalsIgnoreCase("refreshtime"))
/* 680 */             this.mdsql = (this.mdsql + metaa[i] + "=\"" + strCurDate + "\",");
/* 681 */           else if ((para[i].equalsIgnoreCase("")) || (para[i].equals("null")))
/* 682 */             this.mdsql = (this.mdsql + metaa[i] + "=\"\", ");
/*     */           else {
/* 684 */             this.mdsql = (this.mdsql + metaa[i] + "=" + '"' + para[i] + '"' + ',');
/*     */           }
/*     */         }
/* 687 */         else if (metaa[i].equalsIgnoreCase("refreshtime"))
/* 688 */           this.mdsql = (this.mdsql + metaa[i] + "=\"" + strCurDate + "\" ");
/* 689 */         else if ((para[i].equalsIgnoreCase("")) || (para[i].equals("null")))
/* 690 */           this.mdsql = (this.mdsql + metaa[i] + "=\"\" ");
/*     */         else {
/* 692 */           this.mdsql = (this.mdsql + metaa[i] + "=" + '"' + para[i] + '"' + ' ');
/*     */         }
/*     */       }
/*     */ 
/* 696 */       this.mdsql = (this.mdsql + " where id=" + '"' + this.wheresw + '"');
/*     */     }
/*     */     try {
/* 699 */       this.mdsql = new String(this.mdsql.getBytes("ISO8859-1"), "UTF-8");
/* 700 */       System.out.println(this.mdsql);
/* 701 */       this.dbcon.execUpdate(this.mdsql);
/*     */     }
/*     */     catch (Exception ex) {
/* 704 */       flag = false;
/* 705 */       ex.printStackTrace();
/*     */     }
/* 707 */     return flag;
/*     */   }
/*     */ 
/*     */   public boolean mdByID(String[] para, String strSNID)
/*     */   {
/* 713 */     dbConInit();
/*     */ 
/* 715 */     boolean flag = true;
/* 716 */     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
/* 717 */     String strCurDate = sdf.format(new Date());
/*     */ 
/* 719 */     String[] metaa = new String[para.length];
/*     */     try {
/* 721 */       metaa = meta(scmeta());
/*     */     } catch (Exception ex) {
/* 723 */       flag = false;
/* 724 */       ex.printStackTrace();
/*     */     }
/*     */ 
/* 727 */     this.mdsql = ("update " + this.tablesw + " set ");
/* 728 */     for (int i = 1; i < para.length; i++) {
/* 729 */       if (i < para.length - 1) {
/* 730 */         if (metaa[i].equalsIgnoreCase("refreshtime"))
/* 731 */           this.mdsql = (this.mdsql + metaa[i] + "=\"" + strCurDate + "\",");
/* 732 */         else if ((para[i].equalsIgnoreCase("")) || (para[i].equals("null")))
/* 733 */           this.mdsql = (this.mdsql + metaa[i] + "=\"\", ");
/*     */         else {
/* 735 */           this.mdsql = (this.mdsql + metaa[i] + "=" + '"' + para[i] + '"' + ',');
/*     */         }
/*     */       }
/* 738 */       else if (metaa[i].equalsIgnoreCase("refreshtime"))
/* 739 */         this.mdsql = (this.mdsql + metaa[i] + "=\"" + strCurDate + "\" ");
/* 740 */       else if ((para[i].equalsIgnoreCase("")) || (para[i].equals("null")))
/* 741 */         this.mdsql = (this.mdsql + metaa[i] + "=\"\" ");
/*     */       else {
/* 743 */         this.mdsql = (this.mdsql + metaa[i] + "=" + '"' + para[i] + '"' + ' ');
/*     */       }
/*     */     }
/*     */ 
/* 747 */     this.mdsql = (this.mdsql + " where id=" + '"' + strSNID + '"');
/*     */ 
/* 749 */     System.out.println("Update:" + this.mdsql);
/*     */     try
/*     */     {
/* 752 */       this.mdsql = new String(this.mdsql.getBytes("ISO8859-1"), "UTF-8");
/* 753 */       System.out.println(this.mdsql);
/* 754 */       this.dbcon.execUpdate(this.mdsql);
/*     */     }
/*     */     catch (Exception ex) {
/* 757 */       flag = false;
/* 758 */       ex.printStackTrace();
/*     */     }
/* 760 */     return flag;
/*     */   }
/*     */ 
/*     */   public boolean del()
/*     */   {
/* 766 */     dbConInit();
/*     */ 
/* 768 */     boolean flag = true;
/* 769 */     if (this.idsw.equalsIgnoreCase("")) {
/* 770 */       this.delsql = ("delete from " + this.tablesw + " where occode=" + '"' + this.wheresw + '"');
/*     */     }
/*     */     try
/*     */     {
/* 774 */       this.delsql = new String(this.delsql.getBytes("ISO8859-1"), "UTF-8");
/* 775 */       this.dbcon.execUpdate(this.delsql);
/*     */     }
/*     */     catch (Exception ex) {
/* 778 */       flag = false;
/* 779 */       ex.printStackTrace();
/*     */     }
/* 781 */     return flag;
/*     */   }
/*     */ 
/*     */   public boolean delbyid(String strID)
/*     */   {
/* 787 */     dbConInit();
/*     */ 
/* 789 */     boolean flag = true;
/* 790 */     this.delsql = ("delete from " + this.tablesw + " where id=" + '"' + strID + '"');
/*     */     try {
/* 792 */       this.delsql = new String(this.delsql.getBytes("ISO8859-1"), "UTF-8");
/* 793 */       this.dbcon.execUpdate(this.delsql);
/*     */     }
/*     */     catch (Exception ex) {
/* 796 */       flag = false;
/* 797 */       ex.printStackTrace();
/*     */     }
/* 799 */     return flag;
/*     */   }
/*     */ 
/*     */   public Boolean DisableTr() {
/* 803 */     dbConInit();
/* 804 */     boolean flag = true;
/*     */     try
/*     */     {
/* 807 */       this.dbcon.trgDisable();
/*     */     } catch (Exception ex) {
/* 809 */       flag = false;
/* 810 */       ex.printStackTrace();
/*     */     }
/* 812 */     return Boolean.valueOf(flag);
/*     */   }
/*     */ 
/*     */   public Boolean AbleTr() {
/* 816 */     dbConInit();
/*     */ 
/* 818 */     boolean flag = true;
/*     */     try
/*     */     {
/* 821 */       this.dbcon.trgEnable();
/*     */     } catch (Exception ex) {
/* 823 */       flag = false;
/* 824 */       ex.printStackTrace();
/*     */     }
/* 826 */     return Boolean.valueOf(flag);
/*     */   }
/*     */ 
/*     */   public ResultSet excelve(String ve) throws Exception
/*     */   {
/* 831 */     dbConInit();
/*     */ 
/* 833 */     this.scsql = ("select * from " + ve);
/* 834 */     this.scsql = new String(this.scsql.getBytes("ISO8859-1"), "UTF-8");
/*     */ 
/* 836 */     return this.dbcon.execQuery(this.scsql);
/*     */   }
/*     */ }

/* Location:           E:\java\apache-tomcat-6.0.36\webapps\btsm\WEB-INF\classes\
 * Qualified Name:     btsm.bean.sqlCableWork
 * JD-Core Version:    0.6.2
 */